//---------------Sonic CD Special Setup Script----------------//
//--------Scripted by Christian Whitehead 'The Taxman'--------//
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//

// Aliases

// Universal
private alias Object.Value5 : Object.ScreenDepth

private alias Object.Value8 : Screen.Adjust
// UFO Alias
private alias Object.YPos : Object.ZPos

private alias Object.Value3 : rain.scroll


event ObjectDraw
	rain.scroll += 3
	rain.scroll &= 31
	temp0 = rain.scroll

	//so it always reaches the edge
	temp3 = screen.xsize
	temp3 += screen.xcenter
	Screen.Adjust = temp3

	while temp0 < screen.ysize
		temp1 = 0
		while temp1 < Screen.Adjust
			DrawSpriteScreenFX(0, FX_INK, temp1, temp0)
			temp1 += 64		
		loop
		temp0 += 64
	loop	

	object.InkEffect = INK_ALPHA
	object.alpha = 96

end event


event ObjectStartup
	
	// Despite not having any SpriteFrames to draw with, go ahead and load the Special Stage objects sheet anyway
	// (It doesn't make much of a difference but hey, may as well anyway!)
	LoadSpriteSheet("3D_Test/Objects.gif")
	
	// 1 - Standing Frame
	SpriteFrame(-20, -24, 64, 64, 447, 190)

	Object[32].Type = TypeName[Rain Effect]
	Object[32].Priority = PRIORITY_ACTIVE


	// Give it a draw order lower right before the primary one, to make sure it can sort all the upcoming 3d entities correctly
	Object[32].DrawOrder = 4

	
end event


// ========================
// Editor events
// ========================

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143) // "Script" Box

	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
